/**
 * 消费能力管理初始化
 */
var YellowNumberLog = {
    id: "YellowNumberLogTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
YellowNumberLog.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '', field: 'id', visible: false, align: 'center', valign: 'middle', width: '50px'},
        {title: '操作人', field: 'singlePerson', align: 'center', valign: 'middle', sortable: true},
        {title: '患者电话', field: 'customerPhone', align: 'center', valign: 'middle', sortable: true},
        {title: '患者姓名', field: 'customerName', align: 'center', valign: 'middle', sortable: true},
        {
            title: '操作时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true,
            formatter: function (value, row, index) {
                return value.substring(0, 19);
            }
        },
        {title: '详情', field: 'classname', align: 'center', valign: 'middle', sortable: true},
        {title: '是否成功', field: 'succeed', align: 'center', valign: 'middle', sortable: true},
    ];
};

/**
 * 查询表单提交参数对象
 * @returns {{}}
 */
YellowNumberLog.formParams = function () {
    var queryData = {};
    queryData['singlePerson'] = $("#singlePerson").val();
    queryData['customerPhone'] = $("#customerPhone").val();
    queryData['customerName'] = $("#customerName").val();
    queryData['startTime'] = $("#startTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
}

YellowNumberLog.resetSearch = function () {
    $("#singlePerson").val("");
    $("#customerPhone").val("");
    $("#customerName").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    YellowNumberLog.search();
};

/**
 * 查询列表
 */
YellowNumberLog.search = function () {
    YellowNumberLog.table.refresh({query: YellowNumberLog.formParams()});
};

$(function () {
    var defaultColunms = YellowNumberLog.initColumn();
    var table = new BSTable(YellowNumberLog.id, "/customerStatusLog/yellowList", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(YellowNumberLog.formParams());
    YellowNumberLog.table = table.init();
    YellowNumberLog.table = table;
});
